package com.dong.es.entity.searchparam.query.exist;

import co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery;

/**
 * @description: Es 查询 不存在 参数
 * @author: 陈瑞东
 * @create: 2022-06-23 12:26
 */
public class EsNotExistParam extends EsExistBaseParam{

    private static final long serialVersionUID = -88614913389419931L;

    public EsNotExistParam(String field) {
        super(field);
    }

    @Override
    public void loadTo(BoolQuery.Builder target) {
        target.mustNot(mustNot -> mustNot.exists(exists -> exists.field(field)));
    }
}
